I keep getting the following error when running the script created in the lesson about classes: unbound method multiplication() must be called with calculator_1 instance as first argument (got int instance instead)
Here is the code that I'm using:
class calculator:
def addition (x, y): added = x + y print added
def substraction (x, y): sub = x - y print sub
def multiplication(x, y): mult = x * y print mult
def division(x, y): div = x / y print div
calculator.multiplication(3, 5)
You must be logged in to post. Please login or register an account.
Looks like you're using Python 2 here. This is meant to be used with Python 3+.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.